<template>
  <div>
    <el-table ref="refTable" :data="businessData" border style="width: 100%">
      <el-table-column
        v-for="(item, index) in tableField"
        :key="index"
        :label="item.label"
        align="left"
        :width="item.width"
      >
        <template #default="scope">
          <!-- 客户类型 -->
          <div v-if="item.type == 'text'">
            <!-- {{ scope.row.title }} -->
            {{ businessData[scope.$index].title }}
          </div>
          <div v-else-if="item.type == 'input' && item.label == '未跟进天数'">
            超过
            <el-input
              style="width: 50px"
              v-model="businessData[scope.$index][item.value]"
            />
            天未成交
          </div>
          <div
            v-else-if="item.type == 'input' && item.label == '销售人员提醒时间'"
          >
            并在划入公海前
            <el-input
              style="width: 50px"
              v-model="businessData[scope.$index][item.value]"
            />
            天提醒销售人员及时跟进
          </div>
          <div
            v-else-if="
              item.type == 'input' && item.label == '划入垃圾池客户时间'
            "
          >
            系统会在每天
            <el-input
              style="width: 50px"
              v-model="businessData[scope.$index][item.value]"
            />
            将客户划入垃圾客户池
          </div>
          <div v-else-if="item.type == 'date'">
            系统会在每天
            <el-time-picker
              format="HH:mm"
              v-model="businessData[scope.$index][item.value]"
              style="width: 100px"
            />
            将客户划入公海
          </div>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script setup name="parameterTable">
import { computed, getCurrentInstance, reactive, toRefs } from 'vue'
const { proxy } = getCurrentInstance()
const props = defineProps({
  tableField: Array,
  tableData: Array
})

const data = reactive({
  businessData: props.tableData
})
const { businessData } = toRefs(data)

// watchEffect(() => {
//   data.businessData = props.tableData
// })

//  businessData.value = props.tableData
console.log('tableData', props.tableData)
</script>
